<?php
/**
 * 获取一年的所有考评月
 */
apf_require_controller("Abstract");
apf_require_class("Bll_Jx_Setting");
class Ajax_GetKpMonthController extends AbstractController {
    public function handle_request() {
        $params = $this->request->get_parameters();
        $year = $params['year'];
        if(empty($year)){
            $this->json_encode(0, Const_Tip::ERROR_PARAM);
        }
        $set_bll = new Bll_Jx_Setting();
        $data = $set_bll->get_performance_month($year);

        $last = array();
        if(!empty($data)){
            foreach ($data as $val){
                $last[] = array(
                        's_month'=>substr($val,4,2),
                        's_s'=>intval(substr($val,4,2)),
                        'e_month'=>substr($val,6),
                        'e_s'=>intval(substr($val,6)),
                        );
            }
        }
        $this->json_encode(1, $last);
    }
}